home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / dev / mui / bcc_src.lha / Parser / NotUniqueTags.cpp < prev    next >
C/C++ Source or Header  |  1998-03-15  |  1KB  |  80 lines

  1. #include "Global.h"
  2. #include "ClassDef.h"
  3. #include "MethodDef.h"
  4. #include "VarDef.h"
  5.  
  6. #define N 100
  7.  
  8. struct ct {
  9.     unsigned long tag;
  10.     TextItem *ti;
  11. };
  12.  
  13. short ClassDef::CheckDoubleTags( void )
  14. {
  15.     short ret = 0, cnt;
  16.     ct *c;
  17.     
  18.     c = new ct[N];
  19.     
  20.     cnt = 0;
  21.     
  22.     FScan( MethodDef, md, this ) {
  23.         c[cnt].tag = md->GetTagVal();
  24.         c[cnt].ti = (TextItem*)md;
  25.         cnt++;
  26.         if( cnt >= N ) break;
  27.     }
  28.  
  29.     FScan( VarDef, vd, &(Var) ) {
  30.         c[cnt].tag = vd->GetTagVal();
  31.         c[cnt].ti = (TextItem*)vd;
  32.         cnt++;
  33.         if( cnt >= N ) break;
  34.     }
  35.  
  36.     short f, g;
  37.     for( f = 0; f < cnt; f++ ) 
  38.         for( g = f+1; g < cnt; g++ ) 
  39.             if( c[f].tag == c[g].tag ) {
  40.                 printf( "Warning!! Tags: \"%s\" and \"%s\" have the same tag value.\n  Change name of one of them immediately!!\n", c[f].ti->Name, c[f].ti->Name );
  41.                 ret = 1;
  42.             }
  43.     
  44.  
  45.     delete c;
  46.     
  47.     return ret;
  48.  
  49. }
  50.  
  51. short GlobalDef::CheckDoubleTags( void )
  52. {
  53.     short ret = 0, cnt;
  54.     ct *c;
  55.     
  56.     c = new ct[N];
  57.     
  58.     cnt = 0;
  59.     FScan( ClassDef, cd1, &ClassList ) {
  60.         c[cnt].tag = cd1->GetTagVal();
  61.         c[cnt].ti = (TextItem*)cd1;
  62.         cnt++;
  63.         if( cnt >= N ) break;
  64.     }
  65.  
  66.     short f, g;
  67.     for( f = 0; f < cnt; f++ ) 
  68.         for( g = f+1; g < cnt; g++ ) 
  69.             if( c[f].tag == c[g].tag ) {
  70.                 printf( "Warning!! Classes: \"%s\" and \"%s\" produce the same root of tag value.\n  Change name of one of them immediately!!\n", c[f].ti->Name, c[f].ti->Name );
  71.                 ret = 1;
  72.             }
  73.     
  74.     
  75.     delete c;
  76.     
  77.     return ret;
  78.  
  79. }
  80.